<!DOCTYPE html>
<html lang="zh-CN">





<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/apple-touch-icon.jpg">
  <link rel="icon" type="image/png" href="/img/favicon.jpg">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="description" content="前端学习交流">
  <meta name="author" content="小侯爷">
  <meta name="keywords" content="">
  <title>Hexo深坑之旅（4）— Mac系统下搭建Hexo - 小侯爷的前端画室</title>

  <link  rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/css/bootstrap.min.css" />
<link  rel="stylesheet" href="https://cdn.staticfile.org/github-markdown-css/4.0.0/github-markdown.min.css" />


  <link  rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/10.0.0/styles/vs2015.min.css" />


<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_fmb4a04yx8h.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_pjno9b9zyxs.css">




<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->

  
<link rel="stylesheet" href="/css/dark.css">



  <script>
  var _hmt = _hmt || [];
  (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?838b8f18434ba2e0a7cf1855bd16fc57";
    var s = document.getElementsByTagName("script")[0]; 
    s.parentNode.insertBefore(hm, s);
  })();
  </script>
<meta name="generator" content="Hexo 4.2.1"></head>


<body>
  <div id="dark" onclick="switchDarkMode()"></div>
  <script>
    var isNight = new Date().getHours() >= 22 || new Date().getHours() < 7; // 指定时间
    // 依次判断 系统暗黑模式 指定时间 缓存 dark
    if( matchMedia('(prefers-color-scheme: dark)').matches || isNight || localStorage.getItem('dark') === '1') {
      if(!(isNight&&localStorage.getItem('noDark') === '1')) {
        document.body.classList.add('dark');
      }
    }
    let sun = '<img class="dark-img" src="https://frontend-studio-1256354221.file.myqcloud.com/img/sun.png" srcset="/img/loading.gif">';
    let moon = '<img class="dark-img" src="https://frontend-studio-1256354221.file.myqcloud.com/img/moon.png" srcset="/img/loading.gif">'
    document.getElementById('dark').innerHTML = document.querySelector("body").classList.contains("dark")?moon:sun;
    //点击事件
    function switchDarkMode() {
    	if ($('body').hasClass('dark')) {
        $("#dark").html("<img class='dark-img' src='https://frontend-studio-1256354221.file.myqcloud.com/img/sun.png'>");
    		document.body.classList.remove('dark');
    		localStorage.setItem('noDark', '1');
    		localStorage.setItem('dark', '0');
    	} else {
        $("#dark").html("<img class='dark-img' src='https://frontend-studio-1256354221.file.myqcloud.com/img/moon.png'>");
    		document.body.classList.add('dark');
    		localStorage.setItem('dark', '1');
    		localStorage.setItem('noDark', '0');
    	}
    }
  </script>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand"
       href="/">&nbsp;<strong>小侯爷的前端画室</strong>&nbsp;</a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/index/">
              <i class="iconfont icon-home-fill"></i>
              首页</a>
          </li>
        
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/game/">
              <i class="iconfont icon-switch-fill"></i>
              游戏堂</a>
          </li>
        
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/photo/">
              <i class="iconfont icon-images"></i>
              相册集</a>
          </li>
        
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/archives/">
              <i class="iconfont icon-archive-fill"></i>
              文章归档</a>
          </li>
        
          
          
          
          <li class="nav-item">
            <a class="nav-link" href="/about/">
              <i class="iconfont icon-user-fill"></i>
              关于</a>
          </li>
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" data-toggle="modal" data-target="#modalSearch">&nbsp;&nbsp;<i
                class="iconfont icon-search"></i>&nbsp;&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="view intro-2" id="background" parallax=true
         style="background: url('https://frontend-studio-1256354221.file.myqcloud.com/img/banner_2.jpg') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="container text-center white-text fadeInUp">
            <span class="h2" id="subtitle">
              
            </span>

            
              
                <div class="mt-3 post-meta">
                  <i class="iconfont icon-date-fill" aria-hidden="true"></i>
                  <time datetime="2017-04-30 00:00">
                    2017年4月30日 凌晨
                  </time>
                </div>
              

              <div class="mt-1">
                
                  
                  <span class="post-meta mr-2">
                    <i class="iconfont icon-chart"></i>
                    1.3k 字
                  </span>
                

                
                  
                  <span class="post-meta mr-2">
                      <i class="iconfont icon-clock-fill"></i>
                    
                    
                    15
                     分钟
                  </span>
                

                
              </div>
            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid">
  <div class="row">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-md">
      <div class="container nopadding-md" id="board-ctn">
        <div class="py-5" id="board">
          <div class="post-content mx-auto" id="post">
            
            <article class="markdown-body">
              <meta name="referrer" content="no-referrer" />

<blockquote>
<p><strong>前言</strong>：此前笔者曾在win7系统中用hexo+jacman搭建过一次个人博客，期间几经波折，踏过不少深坑。而由于前段时间刚入手了一台MacAir，不得已又要再次踏上这场深坑之旅。好在万变不离其中，虽说是两个系统，但大部分的操作还是相同的，所以在这篇文章中主要介绍Mac系统下的注意点。而至于详细的操作请参考笔者的另一篇文章：<a href="http://www.jianshu.com/p/3d7e8946da8f" target="_blank" rel="noopener">Hexo深坑之旅（1）- win7系统下安装hexo</a></p>
</blockquote>
<h2 id="开始须知"><a href="#开始须知" class="headerlink" title="开始须知"></a>开始须知</h2><h3 id="终端"><a href="#终端" class="headerlink" title="终端"></a>终端</h3><h4 id="打开"><a href="#打开" class="headerlink" title="打开"></a>打开</h4><p>按下快捷键 Ctrol+ Space 空格键，激活 Spotlight 搜索,随后在搜索框中输入“终端”关键字。</p>
<p><img src="https://upload-images.jianshu.io/upload_images/2031241-1cbfe8d898b85321.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" srcset="/img/loading.gif" alt="终端.png"></p>
<h4 id="命令"><a href="#命令" class="headerlink" title="命令"></a>命令</h4><p>cd 前往目标文件。例:</p>
<div class="hljs"><pre><code class="hljs plain">cd &#x2F;Users&#x2F;Desktop&#x2F;前端画室&#x2F;web前端&#x2F;blog</code></pre></div>
<h2 id="1-环境配置"><a href="#1-环境配置" class="headerlink" title="1.环境配置"></a>1.环境配置</h2><p>###1. 1Node.js<br><img src="https://upload-images.jianshu.io/upload_images/2031241-92a9578f915892fa.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" srcset="/img/loading.gif" alt="node.js"><br>Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境。 简单来说你也可以把它看成是一个运行在服务器端的JavaScript语言。这里主要是用于创建hexo博客的框架从而生成静态页面。<br><a href="https://nodejs.org/en/" target="_blank" rel="noopener">Node.js官网</a><br><a href="http://nodejs.cn/" target="_blank" rel="noopener">Node.js官网（中文）</a><br>这里推荐下载v6版本，因为v7版本的坑比较多，不适合新手。<br>下载安装后，可以在终端中用以下命令检测是否安装成功。</p>
<div class="hljs"><pre><code class="hljs plain">node -v
npm -v</code></pre></div>
<p>如果有版本号显示则表示安装成功</p>
<div class="hljs"><pre><code class="hljs plain">Macbook Air：blog$ node -v
v6.10.1
Macbook Air：blog$ npm -v
3.10.10</code></pre></div>
<p>###1.2 Git<br><a href="https://git-scm.com/" target="_blank" rel="noopener">Git官网</a><br>Git是一款免费、开源的分布式版本控制系统，所谓分布式（类似于星形网络）即是可以将项目分布到任何一台电脑中供用户使用，使每台电脑都相当于“主服务器”。而版本控制则可以查看每一次提交或修改的历史记录。Git的优点在于可以灵活高效地处理任何或小或较大的项目。<br><img src="https://upload-images.jianshu.io/upload_images/2031241-e21ed633b46e0a1f.jpeg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" srcset="/img/loading.gif" alt="git"></p>
<h4 id="1-2-1-xcode"><a href="#1-2-1-xcode" class="headerlink" title="1.2.1 xcode"></a>1.2.1 xcode</h4><p>对于Mac用户来说推荐使用苹果开发的 xcode ，自带有git，可以在App Store中自行下载安装。<br><img src="https://upload-images.jianshu.io/upload_images/2031241-1cce405dba97da9e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" srcset="/img/loading.gif" alt="Xcode.png"><br>由于xcode默认没有安装命令行工具，因此安装完成后，还需要在xcode中下载 Command Line Tools 工具。<br>（1） 在终端（terminal）中输入命令：</p>
<div class="hljs"><pre><code class="hljs plain">$ xcode-select --install</code></pre></div>
<p>（2）安装 xcode-select<br><img src="https://upload-images.jianshu.io/upload_images/2031241-6f00d7063ed2e0a7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" srcset="/img/loading.gif" alt="xcode-select.png"><br>（3）再次在终端（terminal）中输入命令：<code>xcode-select --install</code> 检验是否安装成功：<br><img src="https://upload-images.jianshu.io/upload_images/2031241-40e2a048680c1d36.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" srcset="/img/loading.gif" alt="xcode-select --install.png"><br>如上图，则成功安装。这时在打开xcode新建一个项目，选择macOS，就能看到 Command Line Tools<br><img src="https://upload-images.jianshu.io/upload_images/2031241-c87a4522af46081f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" srcset="/img/loading.gif" alt="tool.png"></p>
<h4 id="1-2-2-下载安装包"><a href="#1-2-2-下载安装包" class="headerlink" title="1.2.2 下载安装包"></a>1.2.2 下载安装包</h4><p>mac也可以使用 <a href="http://mxcl.github.com/homebrew/" target="_blank" rel="noopener">Homebrew</a>, <a href="http://www.macports.org/" target="_blank" rel="noopener">MacPorts</a> ：<code>brew install git</code><br>;或下载 <a href="http://sourceforge.net/projects/git-osx-installer/" target="_blank" rel="noopener">安装程序</a> 安装。<br>本人并没有尝试，所以不多说，详细方法可查看<a href="https://hexo.io/zh-cn/docs/index.html" target="_blank" rel="noopener">hexo官方文档</a></p>
<h2 id="2-安装Hexo"><a href="#2-安装Hexo" class="headerlink" title="2.安装Hexo"></a>2.安装Hexo</h2><h3 id="2-1安装"><a href="#2-1安装" class="headerlink" title="2.1安装"></a>2.1安装</h3><p>Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 <a href="http://daringfireball.net/projects/markdown/" target="_blank" rel="noopener">Markdown</a>（或其他渲染引擎）解析文章，在几秒内，即可利用靓丽的主题生成静态网页。<br><strong>注意！</strong> <strong>注意！</strong> <strong>注意！</strong><br>由于hexo新版本的问题，很多原来的方法都已失效，因此在搜索资料时一定要注意文章发布时间。<br>查看<a href="https://hexo.io/zh-cn/docs/index.html" target="_blank" rel="noopener">hexo官方文档</a>，打开终端执行命令：</p>
<div class="hljs"><pre><code class="hljs plain">$ npm install -g hexo-cli</code></pre></div>
<p>不过有时会因为权限问题而报错，推荐加上 <code>sudo命令</code> (可能会提示输入系统管理员密码)：</p>
<div class="hljs"><pre><code class="hljs plain">$ sudo npm install -g hexo</code></pre></div>
<h3 id="2-2初始化"><a href="#2-2初始化" class="headerlink" title="2.2初始化"></a>2.2初始化</h3><p>先新建一个文件夹，用来存放hexo，如blog。<br>然后用终端 cd 到blog的目录下，执行命令：</p>
<div class="hljs"><pre><code class="hljs plain">$ hexo init</code></pre></div>
<p>执行：</p>
<div class="hljs"><pre><code class="hljs plain">$ sudo npm install -g</code></pre></div>
<p>执行 <code>$ hexo -v</code> 查看hexo版本：<br><img src="https://upload-images.jianshu.io/upload_images/2031241-21e9ae3e98ec5b6a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" srcset="/img/loading.gif" alt="hexo.png"><br>这时打开blog文件夹，可以看到已经生成了hexo文件<br><img src="https://upload-images.jianshu.io/upload_images/2031241-63408149022b8ad1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" srcset="/img/loading.gif" alt="blog.png"><br>执行命令，开启本地服务器：</p>
<div class="hljs"><pre><code class="hljs plain">$ hexo s</code></pre></div>
<p>然后在浏览器中打开网址<a href="http://0.0.0.0:4000/" target="_blank" rel="noopener">http://localhost:4000</a>，能看到如下页面：<br><img src="https://upload-images.jianshu.io/upload_images/2031241-0c9eec40750c4bf8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" srcset="/img/loading.gif" alt="hexo4000.png"></p>
<h2 id="3-关联Github"><a href="#3-关联Github" class="headerlink" title="3.关联Github"></a>3.关联Github</h2><h3 id="3-1-注册Github账号并创建仓库"><a href="#3-1-注册Github账号并创建仓库" class="headerlink" title="3.1 注册Github账号并创建仓库"></a>3.1 注册Github账号并创建仓库</h3><p>参考：<a href="http://www.jianshu.com/p/3d7e8946da8f" target="_blank" rel="noopener">Hexo深坑之旅（1）- win7系统下安装hexo</a></p>
<h3 id="3-2添加ssh-key到Github"><a href="#3-2添加ssh-key到Github" class="headerlink" title="3.2添加ssh key到Github"></a>3.2添加ssh key到Github</h3><p>首先<strong>检查SSH-keys是否存在</strong>，打开终端执行命令：</p>
<div class="hljs"><pre><code class="hljs plain">MacBook-Air:~ zhoujunyang$ cd ~&#x2F;.ssh
MacBook-Air:.ssh zhoujunyang$ ls
id_rsa		id_rsa.pub	known_hosts</code></pre></div>
<p>如果有文件id_rsa.pub或id_dsa.pub，则直接进入将SSH key添加到Github中，否则进入下一步<strong>生成SSH key</strong>。</p>
<div class="hljs"><pre><code class="hljs plain">$ ssh-keygen -t rsa -C &quot;your_email@example.com&quot;</code></pre></div>
<p><code>your_email@example.com</code> 为Github的邮箱地址。<br>默认会在相应路径下（~/.ssh/id_rsa.pub）生成id_rsa和id_rsa.pub两个文件。<br>打开id_rsa.pub文件，复制里面的信息。<br><img src="https://upload-images.jianshu.io/upload_images/2031241-5cfe6a4b1134268a.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" srcset="/img/loading.gif" alt="ssh.png"></p>
<p>进入Github –&gt; Settings –&gt; SSH keys –&gt; add SSH key:</p>
<p><img src="https://upload-images.jianshu.io/upload_images/2031241-935b0f70af8557da.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" srcset="/img/loading.gif" alt="key.png"></p>
<p>Title里任意添一个标题，将复制的内容粘贴到Key里，点击下方Add key绿色按钮即可。</p>
<p><img src="https://upload-images.jianshu.io/upload_images/2031241-f43b56b6ff6f2e2f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" srcset="/img/loading.gif" alt="title.png"></p>
<h3 id="3-3配置文件"><a href="#3-3配置文件" class="headerlink" title="3.3配置文件"></a>3.3配置文件</h3><p>打开blog文件夹下的 <code>_config.yml</code>文件，修改参数：</p>
<div class="hljs"><pre><code class="hljs plain">deploy:
    type: git
    repository: git@github.com:zhouxiaoyu1994&#x2F;zhouxiaoyu1994.github.io.git
    branch: master</code></pre></div>
<p>你需要将repository后zhouxiaoyu1994换成你自己的用户名。</p>
<h3 id="3-4本地上传"><a href="#3-4本地上传" class="headerlink" title="3.4本地上传"></a>3.4本地上传</h3><p>需先安装 <code>hexo-deployer-git</code></p>
<div class="hljs"><pre><code class="hljs plain">$npm install hexo-deployer-git --save</code></pre></div>
<p>执行命令：</p>
<div class="hljs"><pre><code class="hljs plain">$ hexo clean      清除缓存文件
$ hexo generate     或者hexo g 生成静态文件。
$ hexo deploy            或者hexo d 部署网站。</code></pre></div>
<p>最后，浏览器中打开网址<a href="https://zhouxiaoyu1994.github.io/" target="_blank" rel="noopener">http://zhouxiaoyu1994.github.io</a>（将zhouxiaoyu1994换成你的用户名）能看到和打开<a href="http://localhost:4000" target="_blank" rel="noopener">http://localhost:4000</a> 时一样的页面。</p>

            </article>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                  <div class="post-meta mr-3">
                    <i class="iconfont icon-category"></i>
                    
                      <a class="hover-with-bg" href="/categories/%E5%BC%80%E5%8F%91%E4%B8%8E%E5%A1%AB%E5%9D%91/">开发与填坑</a>
                    
                  </div>
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/tags/Hexo/">Hexo</a>
                    
                      <a class="hover-with-bg" href="/tags/Mac/">Mac</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">本博客所有文章除特别声明外，均采用 <a href="https://zh.wikipedia.org/wiki/Wikipedia:CC_BY-SA_3.0%E5%8D%8F%E8%AE%AE%E6%96%87%E6%9C%AC" target="_blank" rel="nofollow noopener noopener">CC BY-SA 3.0协议</a> 。转载请注明出处！</p>
              
              
                <div class="post-prevnext row">
                  <div class="post-prev col-6">
                    
                    
                      <a href="/2017/05/01/2017050101/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">Hexo深坑之旅（5）—Materia主题优化</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </div>
                  <div class="post-next col-6">
                    
                    
                      <a href="/2017/04/29/2017042901/">
                        <span class="hidden-mobile">Hexo深坑之旅（3）—实用技巧</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </div>
                </div>
              
            </div>

            
              <!-- Comments -->
              <div class="comments" id="comments">
                
                
  <div id="vcomments"></div>
  <script defer src="https://cdn.staticfile.org/valine/1.4.14/Valine.min.js" ></script>

  <script type="text/javascript">
    var oldLoadVa = window.onload;
    window.onload = function () {
      oldLoadVa && oldLoadVa();

      new Valine({
        el: "#vcomments",
        app_id: "Xj9NvwN7LBLvF2dqHLeRY1ix-gzGzoHsz",
        app_key: "kYB3rhk7JSGIP0RNTvgh7HMq",
        placeholder: "说点什么",
        path: window.location.pathname,
        avatar: "retro",
        meta: ["nick","mail","link"],
        pageSize: "10",
        lang: "zh-CN",
        highlight: false,
        recordIP: false,
        serverURLs: "",
      });
    };
  </script>
  <noscript>Please enable JavaScript to view the <a href="https://valine.js.org" target="_blank" rel="nofollow noopener noopener">comments
      powered by Valine.</a></noscript>


              </div>
            
          </div>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div id="tocbot"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    
  </main>

  
    <a id="scroll-top-button" href="#" role="button">
      <i class="iconfont icon-arrowup" aria-hidden="true"></i>
    </a>
  

  
    <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
  

  

  

  <footer class="mt-5">
  <div class="text-center py-3">
    <div>
      <a href="#"><span>前端画室</span></a>
      <i class="iconfont icon-love"></i>
      <a href="https://github.com/xiaohouye1995" target="_blank" rel="nofollow noopener">
        <span>小侯爷</span></a>
    </div>
    

    

    
  </div>
</footer>

<!-- SCRIPTS -->
<script  src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js" ></script>
<script  src="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/js/bootstrap.min.js" ></script>
<script  src="/js/main.js" ></script>


  <script  src="/js/lazyload.js" ></script>



  
  <script  src="https://cdn.staticfile.org/tocbot/4.11.1/tocbot.min.js" ></script>
  <script>
    $(document).ready(function () {
      var boardCtn = $('#board-ctn');
      var boardTop = boardCtn.offset().top;

      tocbot.init({
        tocSelector: '#tocbot',
        contentSelector: '.post-content',
        headingSelector: 'h1,h2,h3,h4,h5,h6',
        linkClass: 'tocbot-link',
        activeLinkClass: 'tocbot-active-link',
        listClass: 'tocbot-list',
        isCollapsedClass: 'tocbot-is-collapsed',
        collapsibleClass: 'tocbot-is-collapsible',
        collapseDepth: 0,
        scrollSmooth: true,
        headingsOffset: -boardTop
      });
      if ($('.toc-list-item').length > 0) {
        $('#toc').css('visibility', 'visible');
      }
    });
  </script>





  <script defer src="https://cdn.staticfile.org/clipboard.js/2.0.6/clipboard.min.js" ></script>
  <script  src="/js/clipboard-use.js" ></script>






<!-- Plugins -->



  <script  src="https://cdn.staticfile.org/typed.js/2.0.11/typed.min.js" ></script>
  <script>
    var typed = new Typed('#subtitle', {
      strings: [
        '  ',
        "Hexo深坑之旅（4）— Mac系统下搭建Hexo&nbsp;",
      ],
      cursorChar: "_",
      typeSpeed: 70,
      loop: false,
    });
    typed.stop();
    $(document).ready(function () {
      $(".typed-cursor").addClass("h2");
      typed.start();
    });
  </script>



  <script  src="https://cdn.staticfile.org/anchor-js/4.2.2/anchor.min.js" ></script>
  <script>
    anchors.options = {
      placement: "right",
      visible: "hover",
      
    };
    var el = "h1,h2,h3,h4,h5,h6".split(",");
    var res = [];
    for (item of el) {
      res.push(".markdown-body > " + item)
    }
    anchors.add(res.join(", "))
  </script>



  <script  src="/js/local-search.js" ></script>
  <script>
    var path = "/local-search.xml";
    var inputArea = document.querySelector("#local-search-input");
    inputArea.onclick = function () {
      searchFunc(path, 'local-search-input', 'local-search-result');
      this.onclick = null
    }
  </script>



  <script  src="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.css" />

  <script>
    $('#post img:not(.no-zoom img, img[no-zoom]), img[zoom]').each(
      function () {
        var element = document.createElement('a');
        $(element).attr('data-fancybox', 'images');
        $(element).attr('href', $(this).attr('src'));
        $(this).wrap(element);
      }
    );
  </script>


















  </body>
</html>
